<?php

class Answers extends Onecore_Controller
{

    public function __construct()
    {
        parent::__construct();
        $this->load->model("elem_questions_answers_model");
        $this->_moduleName = utf8_encode("Modulo modulos_model");
        $this->_moduleDescription = utf8_encode("Description") . $this->_moduleName;
        $this->_modelInstance = $this->elem_questions_answers_model;
    }
  
    public function loadList(){
        $cfg = new stdClass();
        $cfg->start = $this->input->get('start');
        $cfg->limit = $this->input->get('limit');
        $cfg->conditions = new stdClass();
        $cfg->conditions->elem_questions_id = $this->input->get('question_id');
        $cfg->conditions->parent = 0;
        $cfg->orderField = 'description';
        $cfg->orderDirection = 'ASC';
        
        $data = $this->_modelInstance->listEntities($cfg);
        $res = array(
            "success" => true,
            "results" => $data['results'],
            "rows" => $data['items']
        );
        $this->layout->printLike(json_encode($res), "json");
    }
    
}